
// ===============================================================================================================
// -*- C++ -*-
//
// Player.hpp - Player class.
//
// Copyright (c) 2011 Guilherme R. Lampert
// guilherme.ronaldo.lampert@gmail.com
//
// This code is licenced under the MIT license.
//
// This software is provided "as is" without express or implied
// warranties. You may freely copy and compile this source into
// applications you distribute provided that the copyright text
// above is included in the resulting source code.
//
// ===============================================================================================================

#ifndef __PLAYER_HPP__
#define __PLAYER_HPP__

// Local includes
#include <Camera.hpp>
#include <Weapon.hpp>
#include <GameLevel.hpp>

///
/// Player -- Simple game player representation.
///
class Player {

public:

	// Public Constants:

	static const float CAM_MOVE_SPEED;
	static const float CAM_ROTATE_SPEED;

	// Construction / Destruction:

	explicit Player(int intialAmmo, const Vec3 & initialPos);

	~Player(void);

	// Public Interface:

	/// Update the player data. Called every frame.
	void Update(const GameLevel * level, float elapsedTime);

	/// Draw the HUD and player weapon.
	void DisplayHUDAndWeapon(void);

	/// Checks if the initialization failded.
	bool Fail(void) const;

	// Data Access:

	inline Camera & GetCamera(void) { return (camera); /* Editable */ };

	inline Weapon * GetWeapon(void) { return (weapon); /* Editable */ };

	inline float GetAngle(void) const { return (rAngle); };

private:

	/// Checks for keyboard input then update the camera. (System dependant)
	void CameraKeyboardInput(void);

	/// Checks for mouse input then update the camera. (System dependant)
	void CameraMouseInput(void);

private:

	Camera camera;   ///< The player camera. I use the camera position as the player position in the world
	float pitchAmt;  ///< Amout we've looked up or down
	float rAngle;    ///< Angle of rotation for the player. This is used to orient enemies toward the player
	Weapon * weapon; ///< Player weapon object
	Image * hudTextArea; ///< Hud text area, currently a hardcoded image file.
};

#endif // __PLAYER_HPP__